#region Imports

using System;
using MammothMicro.SilverSocket.Protocol.System;

#endregion

namespace MammothMicro.SilverSocket.Shared
{
    /// <summary>
    /// Receives and send messages.
    /// </summary>
    public interface IMessageServer
    {
        #region Delegates and Events

        /// <summary>
        /// Occurs when new client has connected
        /// </summary>
        event EventHandler<ClientStatusChangedEventArgs> ClientConnected;

        /// <summary>
        /// Occurs when client has disconnected
        /// </summary>
        event EventHandler<ClientStatusChangedEventArgs> ClientDisconnected;

        /// <summary>
        /// Occurs when new message has been received
        /// </summary>
        event EventHandler<MessageReceivedEventArgs> MessageReceived;

        #endregion

        /// <summary>
        /// The send message to client.
        /// </summary>
        /// <param name="clientId">
        /// </param>
        /// <param name="message">
        /// </param>
        void SendMessageToClient(Guid clientId, DuplexCbMessage message);

        /// <summary>
        /// Start listening for incoming messages.
        /// </summary>
        void Start();

        /// <summary>
        /// Stop listening for incoming messages.
        /// </summary>
        void Stop();
    }
}